import { http } from '@/utils/http/axios';

/**
 * @description: 公告列表
 */
export function noticesList(data?) {
  return http.request({
    url: '/notices/search',
    method: 'post',
    data,
  });
}

/**
 * @description: 添加公告
 */
export function addNotice(data?) {
  return http.request({
    url: '/notice',
    method: 'post',
    data,
  });
}

/**
 * @description: 公告详情
 */
export function noticeInfo(id) {
  return http.request({
    url: `/notice/${id}`,
    method: 'get',
  });
}

/**
 * @description: 删除公告
 */
export function deleteNotice(id) {
  return http.request({
    url: `/notice/${id}`,
    method: 'DELETE',
  });
}

/**
 * @description: 编辑公告
 */
export function editNotice(data?) {
  return http.request({
    url: '/notice',
    method: 'PATCH',
    data,
  });
}

/**
 * @description: 公告推送
 */
export function noticePush(id) {
  return http.request({
    url: `/notices/push/${id}`,
    method: 'get',
  });
}
